package csc.traning.wpsj.servlet.lessons;

import java.io.File;

public class FileUtilities {
	private static long convertToKB(File e) {
		return (long) (e.length() / 1024L);
	}

	public static void main(String[] args) {
		long a = 2L;
		long b = 3L;
		System.out.print((double) a / b);
	}

	public static long getAllFileSize(File e) {
		long totalSize = 0;
		File[] allFile = e.listFiles();
		if (allFile!=null)
			for (File f : allFile) {
				if (f.exists()) {
					if (f.isDirectory()) {
						totalSize += getAllFileSize(f);
					} else {
						totalSize += convertToKB(f);
					}
				}
			}
		return totalSize;
	}
}
